<template>
  <div>
    <el-row>
      <el-col :span="24">
        <dynForm
          :info-form="infoForm"
          :search-tags="searchTags"
          :select-list="selectList"
          label-width="140px">
          <el-button
            type="primary"
            icon="el-icon-search"
            @click="doSearch"
          >
            {{ $t("search") }}</el-button
            >
        </dynForm>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import crudJob from '@/api/Tooling/toolingBasicInfo'
import { getEqpNameList } from '@/api/equipment/eqpbase'
export default {
  data() {
    return {
      infoForm: {},
      searchTags: [
        { label: this.$t('toolingBarcode'), prop: 'toolingBarcode', tag: 'DynInput' },
        { label: this.$t('eqpName'), prop: 'eqpName', tag: 'DynSelect' },
        { label: this.$t('toolingType'), prop: 'toolingType', tag: 'DynSelect' },
        { label: this.$t('flag'), prop: 'flag', tag: 'DynSelect' },
        { label: this.$t('internalBarcode'), prop: 'internalBarcode', tag: 'DynInput' },
        { label: this.$t('nextPMDate'), prop: '', tag: 'Dyndaterange', event: (value) => {
          this.infoForm.startTime = Array.isArray(value) ? value[0] : null
          this.infoForm.endTime = Array.isArray(value) ? value[1] : null
        } }
      ],
      selectList: {}
    }
  },
  created() {
    getEqpNameList().then((res) => {
      this.$set(this.selectList, 'eqpName', res.data)
    })
    crudJob.GetToolingTypeList().then((res) => {
      this.$set(this.selectList, 'toolingType', res.data)
    })
    crudJob.GetToolingFlagList().then((res) => {
      this.$set(this.selectList, 'flag', res.data)
    })
  },
  methods: {
    doSearch() {
      this.$emit('doSearch', this.infoForm)
    }
  }
}
</script>
<style lang="scss" scoped>
@import "~@/assets/styles/defaultStyle.scss";
.el-form{
 .el-form-item{
  margin-bottom: 15px;
}
}
</style>
